//
//  MainView.m
//  LStyle
//
//  Created by Obaid Abdul Maroof on 29/11/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "MainView.h"


@implementation MainView
@synthesize lblLogOut, sbSearch, lblAboutUs, lblProfile, lblInvitation, lblMail;
@synthesize lblForum, lblSocial;
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
	self.navigationController.navigationBarHidden = YES;
}

- (void)dealloc {
    [super dealloc];
}

-(void) LogOut:(id) sender{
//	LoginView *lv= [[LoginView alloc] initWithNibName:@"LoginView" bundle:[NSBundle mainBundle]];
	[self.navigationController popViewControllerAnimated:YES];
//	[lv release];
}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
	NSSet *allTouches = [event allTouches];
	
	//Get the first touch.
	UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
	
	if (touch.view == lblLogOut)
		[self.navigationController popViewControllerAnimated:YES];
	
	if (touch.view == lblAboutUs){
		AboutUsView *vcAboutUs = [[AboutUsView alloc] initWithNibName:@"AboutUsView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcAboutUs animated:YES];
		[vcAboutUs release];
	}
	
	if (touch.view == lblProfile){
		Profile *vcProfile = [[Profile alloc] initWithNibName:@"Profile" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcProfile animated:YES];
		[vcProfile release];
	}
	
	if (touch.view == lblBlog){
		BlogMainView *vcBlog = [[BlogMainView alloc] initWithNibName:@"BlogMainView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcBlog animated:YES];
		[vcBlog release];
	}
	
	if (touch.view == lblInvitation){
		InvitationView *vcInvite = [[InvitationView alloc] initWithNibName:@"InvitationView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcInvite animated:YES];
		[vcInvite release];
	}
	
	if (touch.view == lblAlbums){
		Album *alb = [[Album alloc] initWithNibName:@"Album" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:alb animated:YES];
		[alb release];
	}

	if (touch.view == lblMail){
		MailView *vcMail = [[MailView alloc] initWithNibName:@"MailView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcMail animated:YES];
		[vcMail release];
	}
	
	if (touch.view == lblForum){
		ForumView *vcForum = [[ForumView alloc] initWithNibName:@"ForumView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcForum animated:YES];
		[vcForum release];
	}
	
	if (touch.view == lblSocial){
		SocialLifeView *vcSocial = [[SocialLifeView alloc] initWithNibName:@"SocialLifeView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcSocial animated:YES];
		[vcSocial release];
	}
	
	if (touch.view == lblConceirge){
		ConceirgeView *vcConceirge = [[ConceirgeView alloc] initWithNibName:@"ConceirgeView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcConceirge animated:YES];
		[vcConceirge release];
	}
	
	
	if (touch.view == lblMagzine){
		MagzineView *vcMagzine = [[MagzineView alloc] initWithNibName:@"MagzineView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcMagzine animated:YES];
		[vcMagzine release];
	}
	
	if (touch.view == lblCityGuide){
		CityGuide *vcCityGuide = [[CityGuide alloc] initWithNibName:@"CityGuide" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcCityGuide animated:YES];
		[vcCityGuide release];
	}

	if (touch.view == lblMusic){
		MusicPlayerView *vcMusic = [[MusicPlayerView alloc] initWithNibName:@"MusicPlayerView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcMusic animated:YES];
		[vcMusic release];
	}

	if (touch.view == lblEvents){
		EventsView *vcEvents = [[EventsView alloc] initWithNibName:@"EventsView" bundle:[NSBundle mainBundle]];
		[self.navigationController pushViewController:vcEvents animated:YES];
		[vcEvents release];
	}
	
	if ([sbSearch isFirstResponder])
		[sbSearch resignFirstResponder];

}

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
	SearchView *vcSearch = [[SearchView alloc] initWithNibName:@"SearchView" bundle:[NSBundle mainBundle]];
	[self.navigationController pushViewController:vcSearch animated:YES];
	[vcSearch release];
}

@end
